import 'package:flutter/material.dart';

enum EmptyStatus{
  NONE,
  LOADING,
  EMPTY,
  ERROR
}

//空布局基类
abstract class BaseEmptyView extends StatelessWidget{
  @immutable
  EmptyStatus emptyStatus;

  @protected
  Widget buildLoading(BuildContext context);

  @protected
  Widget buildEmpty(BuildContext context);

  @protected
  Widget buildError(BuildContext context);

  @override
  Widget build(BuildContext context) {
    if(emptyStatus == EmptyStatus.EMPTY){
      return buildEmpty(context);
    }else if(emptyStatus == EmptyStatus.ERROR){
      return buildError(context);
    }else if(emptyStatus == EmptyStatus.LOADING) {
      return buildLoading(context);
    }
    return null;
  }
}